#include "crc.h"

unsigned short GetCrc16(const unsigned char* pData, int nLength)
{
	unsigned short fcs = 0xffff;
	while (nLength>0) {
		fcs = (fcs >> 8) ^ crctab16[(fcs ^ *pData) & 0xff];
		nLength--;
		pData++;
	}
	return ~fcs;
}
